import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

import Index from './modules/index.js'
import Order from './modules/order.js'
import Survey from './modules/survey.js'
import Success from './modules/success.js'
import Common from './modules/common.js'
import Product from './modules/product.js'

// const context = require.context('./modules', false, /\.js$/);
// const moduleStores = {};

// context.keys().forEach(key => {
//     // 获取读取到的文件名字并且截取
//     const fileName = key.slice(2, -3);
//     //通过 context(key)导出文件内容
//     const fileModule = context(key).default;
//     moduleStores[fileName] = {
//         ...fileModule,
//     };
// });

export default new Vuex.Store({
    modules: {
        index: Index,
		order: Order,
		survey: Survey,
		success: Success,
		common: Common,
		product: Product
    },
});